home *** CD-ROM | disk | FTP | other *** search
/ Aminet 39 / Aminet 39 (2000)(Schatztruhe)[!][Oct 2000].iso / Aminet / dev / basic / LucyPlayDevBas.lha / joy.bas < prev    next >
Encoding:
BASIC Source File  |  2000-08-24  |  3.5 KB  |  101 lines

  1. ' *********************************************************************
  2. '                         `Joy.bas' example based
  3. '               over the C example wrote by Oliver Gantert
  4. '                 with little modifications/enhacements ;)
  5. '
  6. '              Ejemplo `Joy.bas' basado en la versión en C
  7. '                      escrita por Olivert Gantert
  8. '            (aunque incluye pequeñas modificiones/mejoras ;)
  9. '
  10. '                  C to HBASIC conversion 1.0 (24.8.00)
  11. '                by Dámaso D. Estévez <amidde@arrakis.es>
  12. '               AmiSpaTra - http://www.arrakis.es/~amidde/
  13. ' *********************************************************************
  14.  
  15. REM $include dos.bh
  16. REM $include exec.bc       ' TRUE& (tag/etiqueta)
  17. REM $include lucyplay.bh
  18.  
  19. ' =====================================================================
  20. '                    Global vars / Variables globales
  21. ' =====================================================================
  22.  
  23. lpb&    = NULL&            ' LucyPlayBase
  24.  
  25. '     LucyPlayJoystick struct pointer
  26. ' Puntero a la estructura LucyPlayJoystick
  27. ' ----------------------------------------
  28. j&      = NULL&
  29.  
  30. ' =====================================================================
  31. '                    The main code / El código principal
  32. ' =====================================================================
  33.  
  34. ' Delay()
  35. LIBRARY OPEN "dos.library"
  36. LIBRARY OPEN "lucyplay.library",1&
  37.  
  38. PRINT "-----------------------------------------------------------"
  39. PRINT "  `Joy.bas' example (press red/(1st) fire button to end)   "
  40. PRINT "Ejemplo `Joy.bas' (pulse el botón rojo/fuego para terminar)"
  41. PRINT "-----------------------------------------------------------"
  42. PRINT
  43.  
  44. j& = lucJoyInit&()
  45.  
  46. IF j& THEN
  47.  
  48.     PRINT "[ENGLISH] Check now the joy(stick|pad)!..."
  49.     PRINT "[ESPAÑOL] ¡Pruebe ahora el dispositivo de control!..."
  50.     PRINT
  51.  
  52.     DO WHILE TRUE&
  53.  
  54.         lucJoyRead j&
  55.  
  56.         IF PEEKB(j&+lpjoy_Up%)      THEN PRINT "up";TAB(20);"arriba"
  57.         IF PEEKB(j&+lpjoy_Down%)    THEN PRINT "down";TAB(20);"abajo"
  58.         IF PEEKB(j&+lpjoy_Left%)    THEN PRINT "left";TAB(20);"izquierda"
  59.         IF PEEKB(j&+lpjoy_Right%)   THEN PRINT "right";TAB(20);"derecha"
  60.  
  61.         IF PEEKB(j&+lpjoy_Blue%)    THEN PRINT "blue/2st button";TAB(20);"botón azul/de disparo secundario"
  62.  
  63.         ' ---------------------------------------------------
  64.         '   This code section would be don't work if you use
  65.         '       a not CD32 joypad compatible or with
  66.         '      an auto mouse-joystick switch port! 8'(
  67.         '                      ---
  68.         ' ¡Estas líneas de código podrían no funcionar si no
  69.         '  dispone de un dispositivo de control compatible
  70.         '  CD32 o si utiliza un compartidor de puerto! 8'(
  71.         ' ---------------------------------------------------
  72.         IF PEEKB(j&+lpjoy_Green%)   THEN PRINT "green";TAB(20);"botón verde"
  73.         IF PEEKB(j&+lpjoy_Yellow%)  THEN PRINT "yellow";TAB(20);"botón amarillo"
  74.         IF PEEKB(j&+lpjoy_Forward%) THEN PRINT "forward";TAB(20)'"botón de avance"
  75.         IF PEEKB(j&+lpjoy_Reverse%) THEN PRINT "reverse";TAB(20);"botón de retroceso"
  76.         IF PEEKB(j&+lpjoy_Play%)    THEN PRINT "play/stop";TAB(20);"botón de reproducción/pausa/detención"
  77.         ' --------------------------------------------------
  78.  
  79.         IF PEEKB(j&+lpjoy_Red%)     THEN
  80.             PRINT "red";TAB(20);"botón rojo/de disparo primario"
  81.             EXIT DO
  82.         END IF
  83.  
  84.         '     Why this line? See the Mr Gantert's
  85.         '   explanation included in your C example
  86.         ' -------------------------------------------
  87.         '   ¿Porqué esta línea? Lea la explicación
  88.         ' del Sr. Gantert incluida en su ejemplo en C
  89.         ' -------------------------------------------
  90.         Delay 1
  91.  
  92.     WEND
  93.  
  94.     lucJoyKill joy&
  95.  
  96. END IF
  97.  
  98. LIBRARY CLOSE
  99.  
  100. END
  101.